package com.aa;

import java.util.ArrayList;
import java.util.HashMap;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class AgentActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.agent);
		setupView();
	}
	 private CornerListView cornerListView = null;
	  int[] menu_image_array1 = { R.drawable.jiameng_fangfa, R.drawable.jiameng_zhengce, R.drawable.jiameng_zhuce };
	  int[] menu_name_array1 = { R.string.agent_fangfa, R.string.agent_zhengce, R.string.agent_zhuce };

	  private SimpleAdapter getMenuAdapter(int[] pImage, int[] pText)
	  {
	    ArrayList _ArrayList = new ArrayList();
	    for (int i = 0; ; i++)
	    {
	      if (i >= pImage.length)
	        return new SimpleAdapter(this, _ArrayList, R.layout.more_list_item, new String[] { "title", "img" }, new int[] { R.id.title, R.id.img });
	      HashMap _HashMap = new HashMap();
	      _HashMap.put("title", getString(pText[i]));
	      _HashMap.put("img", Integer.valueOf(pImage[i]));
	      _ArrayList.add(_HashMap);
	    }
	  }

	  private void setupView()
	  {
	    TextView _TextView = (TextView)findViewById(R.id.index_center_tx2);
	    _TextView.setVisibility(View.VISIBLE);
	    _TextView.setText(R.string.agent_tab);
	    cornerListView = ((CornerListView)findViewById(R.id.agent_list));
	    cornerListView.setAdapter(getMenuAdapter(menu_image_array1,menu_name_array1));
	    cornerListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
	    {
	      public void onItemClick(AdapterView<?> AdapterView, View v, int position, long arg3)
	      {
	        Intent _Intent = new Intent();
	        _Intent.setClass(AgentActivity.this, AgentDetail.class);
	        _Intent.putExtra("TYPE", position + 1);
	        AgentActivity.this.startActivity(_Intent);
	      }
	    });
	  }

	 
}
